//
//  CustomButton.m
//  按钮里放入图片和文字
//
//  Created by Tiancheng on 16/9/5.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "CustomButton.h"

@implementation CustomButton

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        //设置粗体文字,以及文字的大小
        self.titleLabel.font = [UIFont boldSystemFontOfSize:13];
        // 设置文字居右
        self.titleLabel.textAlignment = NSTextAlignmentLeft;
        // 设置文字的颜色
        [self setTitleColor:[UIColor grayColor] forState:0];
        // 设置背景图片
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    CGRect titleFrame = CGRectMake(contentRect.size.height+20, -5, contentRect.size.width * 0.6, contentRect.size.height);
    return titleFrame;
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    //contentRect.size.height
    return CGRectMake(5, 0, 20, 20);
}

@end
